/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
    Text, Table, TableBody, TableRow, CCell, useTheme, Cell,
} from "customize-easy-ui-component";
import {DirectLink, } from "../../../routing/Link";
import {RepLink, ReportViewProps,} from "../../common/base";
import {末尾链接,} from "../../common/rarelyVary";
import {填写须知} from "../../escalator/rarelyVary";
import queryString from "query-string";
import {config观测1, config观测2, config观测3, config设备概况,} from "./orcBase";
import {设备概况页} from "../../park/views";
import {首页设备概况Cr} from "../../crane/bridgeDJ/repView";
import {DesignParameterVw} from "./DesignParameter";
import {MainPartsVw} from "./MainParts";
import {PretestCheckVw} from "./PretestCheck";
import {DocumentationVw} from "./Documentation";
import {StructuralTypeVw} from "./StructuralType";
import {PrototypeInspVw} from "./PrototypeInsp";
import {TestingsVw} from "./Testings";
import {UnitnameModifyVw} from "./UnitnameModify";
import {Measure3PartVw} from "./repView";
import {MaxLiftSpeedVw} from "./MaxLiftSpeed";
import {PortalTiltVw} from "./TiltSpeed";
import {TurningRadiusVw} from "./Turning";
import {MaxSpeedVw} from "./Speed";
import {ClimbabilityVw, ElectricTractVw, HookTractionVw, TractionForceVw} from "./Climbability";
import {RodTensileForceVw, StopDistanceVw} from "./StopDistance";
import {FaultRecordVw, ReliabilityVw, TestbedShiftVw} from "./TestbedShift";
import {PerforRetestVw} from "./PerforRetest";
import {ExplosionProofVw, ResistanceVw} from "./ExplosionProof";
import {PrototypeImgVw} from "./PrototypeImg";
import {MeasInstrumentRe} from "./MeasInstrumentRe";
import {SelfWeightVw} from "./SelfWeight";

//没有不合格项目表；
//没有机电都用的项目列表 const {renderIspContent} =useFormatOmni({ItemArs:impressionismAs?.Item,；
export const FormatOriginal: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
    const theme= useTheme();
    const qs= queryString.parse(window.location.search);
    const printing =qs && !!qs.print;
  return (
    <React.Fragment>
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
            <div css={{
                textAlign: "center",
                "& > div": {
                    marginLeft: "auto",
                    marginRight: "auto"
                },
                "@media (min-width:690px),print and (min-width:538px)": {
                    display: "flex",
                    justifyContent: "space-between",
                    flexWrap: 'wrap',
                    "& > div": {
                        margin: theme.spaces.sm,
                    }
                },
                flexDirection: 'row-reverse',
            }}>
                <Text variant="h5" css={{textDecoration: 'underline'}}>FJJ/QB-1002-1-2023</Text>
            </div>
            <Text variant="h3" css={{
                textAlign: 'center',
                "@media (min-width:690px),print and (min-width:538px)": {
                    fontSize: theme.fontSizes[5],
                },
                marginTop: '2rem',
            }}>
                特种设备型式试验原始记录
            </Text>
            <Text variant="h5" css={{textAlign: 'center',}}>
                （适于： 格式化版记录 待续...）
            </Text>
            <div css={{"@media print": {height: '18mm'}}}>
            </div>
            <div css={{
                "@media print": {
                    minHeight: '-webkit-fill-available',
                }
            }}>
                { 首页设备概况Cr( {theme, orc, original:true, } ) }
            </div>
            <div css={{
                "@media print": {
                    height: '20mm'
                }
            }}>
            </div>
            <div css={{
                textAlign: 'center',
                "@media print": {
                    pageBreakAfter: 'always',
                    pageBreakInside: 'avoid'
                }
            }}>
                <Text variant="h4" css={{
                    textAlign: 'center',
                }}>福建省特种设备检验研究院编制</Text>
            </div>
            {填写须知}
            <MeasInstrumentRe orc={orc} rep={rep} label={'1、主要测量设备性能检查'}/>

            <DirectLink href={`/report/${rep?.modeltype}/ver/${verId}/${repId}/Survey`}>
                <Text variant="h4">2、受检样机概况</Text>
            </DirectLink>
            {设备概况页({orc, rep, config: config设备概况, theme,fixed: ["3%", "16.1%", "34%", "3%", "12.9%", "%"] })}

            <DesignParameterVw op orc={orc} rep={rep} title={'3、样机主要参数'}/>
            <MainPartsVw orc={orc} rep={rep}/>
            <PretestCheckVw orc={orc} rep={rep}/>
            <DocumentationVw op orc={orc} rep={rep} title={'7、样机技术资料审查'}/>
            <StructuralTypeVw op orc={orc} rep={rep} title={'8、样机检查'}/>
            <PrototypeInspVw op orc={orc} rep={rep}/>
            <TestingsVw op orc={orc} rep={rep} title={'9、样机试验'}/>

            <Text variant="h4" css={{marginTop: '1rem', "@media print": {pageBreakBefore: 'always', marginTop: 'unset',},
            }}>10 结论</Text>
            <Table>
                <TableBody>
                    <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/ALL`}>
                        <TableRow>
                            <CCell><Text variant="h1" css={{fontSize: '1.5rem'}}>{orc.检验结论}</Text></CCell>
                        </TableRow>
                    </DirectLink>
                </TableBody>
            </Table>
            <Table fixed={["15%", "%", "15%", "20%"]} css={{borderCollapse: 'collapse'}}>
                <TableBody>
                    <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/ALL`}>
                        <TableRow>
                            <CCell css={{border: 'none'}}>检验</CCell>
                            <CCell css={{border: 'none'}}></CCell>
                            <CCell css={{border: 'none'}}>日期</CCell>
                            <CCell css={{border: 'none'}}>2020-01-02</CCell>
                        </TableRow>
                        <TableRow>
                            <CCell css={{border: 'none'}}>校核</CCell>
                            <CCell css={{border: 'none'}}></CCell>
                            <CCell css={{border: 'none'}}>日期</CCell>
                            <CCell css={{border: 'none'}}></CCell>
                        </TableRow>
                    </DirectLink>
                </TableBody>
            </Table>
            <Text variant="h4" css={{marginTop: '1rem',
            }}>11 主要结构型式</Text>
            <Table><TableBody>
                <RepLink ori rep={rep} tag={'Conclusion'}>
                    <TableRow><Cell split={true}><div css={{minHeight: '1rem', whiteSpace: 'pre-wrap'}}>
                        {orc.主结构式 || '／'}
                    </div></Cell></TableRow>
                </RepLink>
            </TableBody></Table>
            <Text variant="h4" css={{marginTop: '1rem',
            }}>12 备注</Text>
            <Table><TableBody>
                <RepLink ori rep={rep} tag={'Conclusion'}>
                    <TableRow><Cell split={true}><div css={{minHeight: '1rem', whiteSpace: 'pre-wrap'}}>
                        {orc.结论备注 || '／'}
                    </div></Cell></TableRow>
                </RepLink>
            </TableBody></Table>

            <Text variant="h3" css={{marginTop: '0.5rem'}}>13、附表</Text>
            <Measure3PartVw config1={config观测1(orc)} config2={config观测2(orc)} config3={config观测3(orc)}
                            orc={orc} rep={rep} mem='观测备注'  label='附表1 测量结果记录'
                               fixed={ ["2.7%", "7.5%", "31%", "8%", "%", "4.5%", "9%", "8%", "5.9%"] } />
            <SelfWeightVw orc={orc} rep={rep} label={'附表2 车辆自重测定记录表(C2.7)'}/>
            <MaxLiftSpeedVw orc={orc} rep={rep} label={'附表3 最大起升速度、下降速度测量记录表（C3.1.1和 C3.1.2）'}/>
            <PortalTiltVw orc={orc} rep={rep} label={'附表4 门架（或货叉架）倾斜速度试验记录表（C3.1.4）'}/>
            <TurningRadiusVw orc={orc} rep={rep} label={'附表5 最小转弯半径测量记录表（C3.2.1）'}/>
            <MaxSpeedVw orc={orc} rep={rep} label={'附表6　最大行驶速度试验记录表（C3.3）'}/>
            <ClimbabilityVw orc={orc} rep={rep} label={'附表7-1 满载最大爬坡度试验记录表（C3.4.1）'}/>
            <TractionForceVw orc={orc} rep={rep} label={'附表7-2 最大牵引力试验记录表（内燃叉车）(C3.4.1)'}/>
            <HookTractionVw orc={orc} rep={rep} label={'附表8 最大挂钩牵引力试验记录表(内燃叉车)(C3.4.2)'}/>
            <ElectricTractVw orc={orc} rep={rep} label={'附表9 最大牵引力、最大挂钩牵引力试验记录表(电动叉车)(C3.4.1和C3.4.2)'}/>
            <RodTensileForceVw orc={orc} rep={rep} label={'附表10 牵引杆拉力测定记录表（C3.5.2和C3.5.4）'}/>
            <StopDistanceVw orc={orc} rep={rep} label={'附表11 制动距离试验记录表(C3.5.3和C3.5.4)'}/>
            <TestbedShiftVw orc={orc} rep={rep} label={'附表12-1 叉车可靠性强化试验台班记录表（C3.10）'}/>
            <FaultRecordVw orc={orc} rep={rep} label={'附表12-2 可靠性强化试验故障记录表（C3.10）'}/>
            <ReliabilityVw orc={orc} rep={rep} label={'附表12-3 可靠性强化试验记录表（C3.10.1）'}/>
            <PerforRetestVw orc={orc} rep={rep} label={'附表12-4 强化试验后性能复测记录表（C3.10.4）'}/>
            <ExplosionProofVw orc={orc} rep={rep} label={'附表13 防爆功能叉车温度试验记录表(C3.11.1)'}/>
            <ResistanceVw orc={orc} rep={rep} label={'附表14 防爆功能叉车接地电阻试验记录表(C3.11.2)'}/>
            <PrototypeImgVw op orc={orc} rep={rep} label={'14 样机图片'}/>
            <UnitnameModifyVw op orc={orc} rep={rep} title={'15、型式试验报告变更情况'}/>
        </div>
        {末尾链接({template:rep?.modeltype,verId, repId: repId||''})}
    </React.Fragment>
  );
}
